from superdice.libs.diceConfigs import configFile
from superdice.superdice import registerRoll, unregisterRoll

def es_map_start(ev):
    cfgData.execute()

def unload():
    unregisterRoll(diceRoll)

def diceRoll(userid, player, eplayer):
    gravity = eplayer.gravity - float(gravitylose)
    if gravity < 0.1:
        eplayer.gravity = 0.1

    else:
        eplayer.gravity = gravity

cfgData = configFile('dice_lowgrav')
gravitylose = cfgData.cvar('superdice_cfg_lowgrav_gravity', 0.4, 'How much gravity does the player lose?')
cfgData.write()
cfgData.execute()

registerRoll(diceRoll, 'lowgrav')
